<?php

/**
 * Creador: Emmet
 * Version: 1.0
 * Copyright (C) 2009 Caos Proyect Team
 */

include "header.php";

function connectdb()
{
//$conn=mysql_connect("localhost","root","password") or die("Unable to connect to the database!");
//mysql_select_db("database",$conn) or die("The database was not found!");
return $conn;
}

function disconnectdb($conn)
{
mysql_close($conn);
}

?>

<html>
<body>

<center><font size="6"><b>LISTA JUGADORES</b></font></center>
<br>


<center><table>
<tr>
    <td>

<center><font size="4"><b>LISTA</b></font></center>
 
    <center><table border="5" cellpadding="1" cellspacing="0">
     <tr>
     
      <th style="background-color: rgb(255, 255, 153);"><font
color="red">Personaje</font></th>
      <th style="background-color: rgb(255, 255, 153);"><font
color="red">Raza</font></th>
      <th style="background-color: rgb(255, 255, 153);"><font
color="red">Clase</font></th>
      <th style="background-color: rgb(255, 255, 153);"><font
color="red">Exp</font></th>

     </tr>
<?php
$sql_command='select username,name,race,class,xp from phaos_characters order by xp desc;';
$conn=connectdb();
$result=mysql_query($sql_command) or die("Unable to extract data from the database!");
disconnectdb($conn);


$i = 0;
while ($character=mysql_fetch_array($result))
{
   if ($i = 1)
   {
      // malo sem popravil stvari   
      if($character['username']!='phaos_npc')
         if($character['username']!='phaos_npc_arena')
            if($character['username']!='phaos_arena_fighting')
            {
         $i++;
               if ($character['race'] == 'Admin')
                  echo("<tr style=\"color:red;\"><td>{$character['username']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
               else
                  echo("<tr class=\"combat\"><td>{$character['name']}</td><td>{$character['race']}</td><td>{$character['class']}</td><td>{$character['xp']}</td></tr>");
            }
   }

}
?>
     </table></center>
  </td>

</tr>
</table></center>

<br>

</body>
</html>

<?php include "footer.php"; ?>